import time

from Base import Base
import selenium
from selenium.webdriver.common.by import By


class Page(Base):

        admin_loc=By.XPATH,'//*[@id="userName"]'

        password_loc=By.XPATH,'//*[@id="password"]'

        login_loc=By.XPATH,'//*[@id="but_login"]'

        dy1_loc=By.XPATH,'//*[@id="navbar-container"]/div[2]/ul/li[3]/a'



        def set_up(self,driver):
            self.driver=driver

        def tear_down(self):
            self.driver.quiet()
            time.sleep(5)

        def admin(self):
            self.click_content(self.admin_loc)

        def password(self):
            self.click_content(self.password_loc)

        def login(self):
            self.click_content(self.login_loc)

        #如果登录成功则会断言成功
        def dy1(self):
            self.find_element(self.dy1_loc).text()
            assert '管理员' in self.dy1()
            print(self.dy1())

        def login_WMS_01(self):
            self.get_URL('http://10.59.9.32/jeewms/loginController.do?login')
            self.admin()
            self.password()
            time.sleep(6)
            self.login()

